import { IPSModelSortable } from '../../ipsmodel-sortable';
import { IPSDataEntity } from '../ipsdata-entity';
import { IPSDEAction } from '../action/ipsdeaction';
import { IPSDEDTSQueue } from './ipsdedtsqueue';
import { IPSSysDTSQueue } from '../../dts/ipssys-dtsqueue';
import { IPSSysSFPlugin } from '../../res/ipssys-sfplugin';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEDTSQueueImpl extends PSModelObjectImpl implements IPSDEDTSQueue, IPSModelSortable {
  protected cancelpsdeaction: IPSDEAction | null = null;

  getCancelPSDEAction(): IPSDEAction | null {
    if (this.cancelpsdeaction != null) return this.cancelpsdeaction;
    const value = this.M.getCancelPSDEAction;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getParentPSModelObject('dataentity.IPSDataEntity') as IPSDataEntity;
    if (ipsdataentity != null) {
      this.cancelpsdeaction = ipsdataentity.findPSDEAction(value);
    }
    return this.cancelpsdeaction;
  }

  get cancelPSDEAction(): IPSDEAction | null {
    return this.getCancelPSDEAction();
  }

  getCancelPSDEActionMust(): IPSDEAction {
    const value = this.getCancelPSDEAction();
    if (value == null) {
      throw new Error('未指定取消操作实体行为');
    }
    return value;
  }

  get cancelTimeout(): number {
    return this.M.cancelTimeout != null ? this.M.cancelTimeout : -1;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  protected confirmpsdeaction: IPSDEAction | null = null;

  getConfirmPSDEAction(): IPSDEAction | null {
    if (this.confirmpsdeaction != null) return this.confirmpsdeaction;
    const value = this.M.getConfirmPSDEAction;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getParentPSModelObject('dataentity.IPSDataEntity') as IPSDataEntity;
    if (ipsdataentity != null) {
      this.confirmpsdeaction = ipsdataentity.findPSDEAction(value);
    }
    return this.confirmpsdeaction;
  }

  get confirmPSDEAction(): IPSDEAction | null {
    return this.getConfirmPSDEAction();
  }

  getConfirmPSDEActionMust(): IPSDEAction {
    const value = this.getConfirmPSDEAction();
    if (value == null) {
      throw new Error('未指定确认操作实体行为');
    }
    return value;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get extendMode(): 0 | 2 {
    return this.M.extendMode != null ? this.M.extendMode : 0;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  get orderValue(): number {
    return this.M.orderValue != null ? this.M.orderValue : 99999;
  }

  protected pssysdtsqueue: IPSSysDTSQueue | null = null;

  getPSSysDTSQueue(): IPSSysDTSQueue | null {
    if (this.pssysdtsqueue != null) return this.pssysdtsqueue;
    const value = this.M.getPSSysDTSQueue;
    if (value == null) {
      return null;
    }
    this.pssysdtsqueue = this.getPSModel4('dts.IPSSysDTSQueue', value, 'getPSSysDTSQueue') as IPSSysDTSQueue;
    return this.pssysdtsqueue;
  }

  get psSysDTSQueue(): IPSSysDTSQueue | null {
    return this.getPSSysDTSQueue();
  }

  getPSSysDTSQueueMust(): IPSSysDTSQueue {
    const value = this.getPSSysDTSQueue();
    if (value == null) {
      throw new Error('未指定系统异步处理队列');
    }
    return value;
  }

  protected pssyssfplugin: IPSSysSFPlugin | null = null;

  getPSSysSFPlugin(): IPSSysSFPlugin | null {
    if (this.pssyssfplugin != null) return this.pssyssfplugin;
    const value = this.M.getPSSysSFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyssfplugin = this.getPSModel4('res.IPSSysSFPlugin', value, 'getPSSysSFPlugin') as IPSSysSFPlugin;
    return this.pssyssfplugin;
  }

  get psSysSFPlugin(): IPSSysSFPlugin | null {
    return this.getPSSysSFPlugin();
  }

  getPSSysSFPluginMust(): IPSSysSFPlugin {
    const value = this.getPSSysSFPlugin();
    if (value == null) {
      throw new Error('未指定后端模板插件对象');
    }
    return value;
  }

  protected pushpsdeaction: IPSDEAction | null = null;

  getPushPSDEAction(): IPSDEAction | null {
    if (this.pushpsdeaction != null) return this.pushpsdeaction;
    const value = this.M.getPushPSDEAction;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getParentPSModelObject('dataentity.IPSDataEntity') as IPSDataEntity;
    if (ipsdataentity != null) {
      this.pushpsdeaction = ipsdataentity.findPSDEAction(value);
    }
    return this.pushpsdeaction;
  }

  get pushPSDEAction(): IPSDEAction | null {
    return this.getPushPSDEAction();
  }

  getPushPSDEActionMust(): IPSDEAction {
    const value = this.getPushPSDEAction();
    if (value == null) {
      throw new Error('未指定推送实体行为');
    }
    return value;
  }

  protected refreshpsdeaction: IPSDEAction | null = null;

  getRefreshPSDEAction(): IPSDEAction | null {
    if (this.refreshpsdeaction != null) return this.refreshpsdeaction;
    const value = this.M.getRefreshPSDEAction;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getParentPSModelObject('dataentity.IPSDataEntity') as IPSDataEntity;
    if (ipsdataentity != null) {
      this.refreshpsdeaction = ipsdataentity.findPSDEAction(value);
    }
    return this.refreshpsdeaction;
  }

  get refreshPSDEAction(): IPSDEAction | null {
    return this.getRefreshPSDEAction();
  }

  getRefreshPSDEActionMust(): IPSDEAction {
    const value = this.getRefreshPSDEAction();
    if (value == null) {
      throw new Error('未指定刷新实体行为');
    }
    return value;
  }

  get refreshTimer(): number {
    return this.M.refreshTimer != null ? this.M.refreshTimer : -1;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get default(): boolean {
    return this.M.default != null ? this.M.default : false;
  }

  get cls(): string {
    return 'PSDEDTSQueueImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'IPSModelSortable' || cls == 'dataentity.dts.IPSDEDTSQueue') return true;
    return super.instanceof(cls);
  }
}
